//sortedType.h
/********************************************************************************
*																				*
*	Author:			Jared Szechy												*
*	Assignment:		Assignment 3												*
*	Class:			CPS-151														*
*	Instructor:		V. Starkley													*
*	Due Date:		September 20												*
*																				*
*	This file declares the BankAccount class.									*
*																				*
********************************************************************************/

#ifndef SORTEDTYPE_H
#define SORTEDTYPE_H

#include "itemType.h"
// ItemType.h must be provided by the user of this class.
// ItemType.h must contain the following definitions:
//   MAX_ITEMS:	the maximum number of items on the list
//   ItemType:	the definition of the objects on the list
//				ItemType must have equality operator defined


class SortedType
{
public:
    SortedType();
	//constructor; creates empty list

    void MakeEmpty();
    // Pre:  none
    // Post: List is empty.

    bool IsFull() const;
    // Pre:  none
    // Post: returns true if list is full; false if list is not full

    int LengthIs() const;
    // Pre:  none
	// Post: returns number elements in list

    bool RetrieveItem(ItemType& item);
    // Pre:  Key member of item is initialized.
    // Post: If there is an element someItem whose key matches 
    //       item's key, item is a copy of someItem and returns true;
	//		 otherwise item is unchanged and functions returns false

    bool InsertItem(ItemType item);
    // Pre:  none 
    // Post: if list is not full, item is addded to list and returns true
	//	     if list is full, returns false
 
    bool DeleteItem(ItemType item);
    // Pre:  Key member of item is initialized.
    //       At most one element in list has a key matching item's key.
    // Post: Returns false if item is not in the list
	//		 else, element is deleted from list and returns true
 
    void ResetList();
    // Pre:  none
    // Post: list is reset so that an iteration through list starts at first item
 
    bool GetNextItem(ItemType& item);
    // Pre:  List has not been changed since it was reset or since
	//		 this function has been called
    // Post: if list is empty or already at end, returns false
	//		 else, item is a copy of next item in list and returns true

private:
    int length;
    ItemType info[MAX_ITEMS];
    int currentPos;
};

#endif